<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="org.jfree.chart.servlet.*
,java.awt.Color
,java.awt.Font
,java.io.FileOutputStream
,java.io.OutputStream
,java.text.DecimalFormat
,java.text.NumberFormat

,org.jfree.chart.ChartFactory
,org.jfree.chart.ChartFrame
,org.jfree.chart.ChartUtilities
,org.jfree.chart.JFreeChart
,org.jfree.chart.labels.StandardPieSectionLabelGenerator
,org.jfree.chart.plot.PiePlot3D
,org.jfree.chart.servlet.ServletUtilities
,org.jfree.chart.title.LegendTitle
,org.jfree.chart.title.TextTitle
,org.jfree.data.general.DefaultPieDataset
,org.jfree.data.general.PieDataset" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'net_chart.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
   <%
   DefaultPieDataset dataset= new DefaultPieDataset();
        dataset.setValue("技术人员", 25);
		dataset.setValue("后勤人员", 12);
		dataset.setValue("销售人员", 26);
  JFreeChart chart=ChartFactory.createPieChart3D("企业人员饼图", dataset, true, false, false);
        chart.getTitle().setFont(new Font("宋体",Font.BOLD,15));
		PiePlot3D plot=(PiePlot3D)chart.getPlot();
		plot.setLabelGenerator(new StandardPieSectionLabelGenerator( 
				"{0}={1}({2})", NumberFormat.getNumberInstance(), 
				new DecimalFormat("0.00%"))); 
		plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator( 
		"{0}={1}({2})",NumberFormat.getNumberInstance(), 
		new DecimalFormat("0.00%"))); 
		plot.setLabelFont(new Font("宋体",Font.BOLD,10));
		plot.setBackgroundPaint(Color.WHITE);
		plot.setBackgroundImageAlpha(0.65f);
		plot.setForegroundAlpha(0.65f); 
		plot.setCircular(false, false); 

		LegendTitle legend=chart.getLegend();
		legend.setItemFont(new Font("宋体",Font.BOLD,10));
   String fileName=ServletUtilities.saveChartAsJPEG(chart,500,300,session);
   String url=request.getContextPath()+"/DisplayChart?filename="+fileName;
    %>
<img src="<%=url%>" width="500" height="300">

  </body>
</html>
